home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swaga_c.zip / CURSOR.SWG / 0020_cursor size attributes.pas < prev    next >
Pascal/Delphi Source File  |  1994-05-25  |  2KB  |  55 lines

  1.  
  2. {
  3.  One way to do it is to change the cursor size attributes. Here are some
  4.  routines I use and a little demo program I wrote for another user a
  5.  while back(Gosh almost a year now<g>). Also if your doing a lot of
  6.  screen writing and either don't want the cursor to move or not be
  7.  visible at all you might want to try looking into direct video memory
  8.  writes.
  9. }
  10.  
  11. PROGRAM CursorDemo;              (*  May 27/93, Greg Estabrooks     *)
  12. USES CRT;                        (*  For Readkey, Clrscr.           *)
  13. CONST
  14.      (* Define Cursor Value to make chaning cursor easier *)
  15.     NoCursor      = $2000;
  16.     DefaultCursor = $0607;
  17.     BlockCursor   = $000A;
  18. VAR
  19.     Curs :WORD;                 (* Stores saved cursor value         *)
  20.     Ch   :CHAR;
  21.  
  22. PROCEDURE SetCursor( Cursor :WORD ); ASSEMBLER;
  23.                      (* Routine to change the shape of the cursor    *)
  24. ASM
  25.   Mov AH,1                      (* Function to change cursor shape   *)
  26.   Mov BH,0                      (* Set Page to 0                     *)
  27.   Mov CX,Cursor                 (* Load new cursor Shape Value       *)
  28.   Int $10                       (* Call Dos                          *)
  29. END;{SetCursor}
  30.  
  31. FUNCTION GetCursor :WORD; ASSEMBLER;
  32.                    (* Routine to return Cursor Shape                 *)
  33. ASM
  34.   Mov AH,3                      (* Function to return cursor shape   *)
  35.   Mov BH,0                      (* Set Page to 0                     *)
  36.   Int $10                       (* Call Dos                          *)
  37.   Mov AX,CX                     (* Move Result to proper register    *)
  38. END;{GetCursor}
  39.  
  40. BEGIN
  41.   Clrscr;                       (* Clear the screen for demonstration*)
  42.   Curs := GetCursor;            (* Save Current Cursor Value         *)
  43.   Writeln('The Cursor is turned off');
  44.   SetCursor( NoCursor );        (* Turn off the cursor               *)
  45.   Ch := Readkey;                (* Pause to show user new cursor     *)
  46.   Writeln('The Cursor is a block shape');
  47.   SetCursor( BlockCursor );     (*  Set the cursor to a block        *)
  48.   Ch := Readkey;
  49.   Writeln('The Cursor is now the normal shape');
  50.   SetCursor( DefaultCursor );   (* Set Default Cursor                *)
  51.   Ch := Readkey;
  52.  
  53.   SetCursor( Curs );            (* Restore cursor to previous style  *)
  54. END.
  55.